package com.kkb.service.login.impl;

import com.kkb.bean.User;
import com.kkb.dao.UserMapper;
import com.kkb.service.login.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LoginServiceImpl implements LoginService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public List<User> findByName(String username) {
        User user = new User();
        user.setUserName(username);
        List<User> select = userMapper.select(user);
        for(User u:select){
            System.out.println(u.getUserName());
        }
        return select;
    }

    @Override
    public List<User> denglu(String username, String password){
        User user = new User();
        user.setUserName(username);
        user.setPassword(password);
        List<User> select = userMapper.select(user);
        for(User u:select){
            System.out.println(u.getUserName());
        }
        return select;
    }

    @Override
    public int zhuce(String username, String password, String phonenumber) {
        User user = new User();
        user.setUserName(username);
        user.setPassword(password);
        user.setPhonenumber(phonenumber);
        int insert = userMapper.insert(user);
        return insert;
    }


}
